package cafe.ejb;

import java.sql.SQLException;
import java.util.List;
import java.util.Set;

import javax.ejb.Local;

import cafe.ejb.myexceptions.EntityNotFoundException;
import cafe.ejb.myexceptions.NoLinksException;
import cafe.jpa.Order;
import cafe.jpa.Waiter;

@Local
public interface WaiterService {
	
	public final int SEARCH_BY_FIRSTNAME = 1;
	public final int SEARCH_BY_LASTNAME = 2;
	public final int SEARCH_BY_PATRONYMICNAME = 3;
	public final int SEARCH_BY_FIRSTNAME_AND_LASTNAME = 4;
	public final int SEARCH_BY_FIRSTNAME_AND_PATRONYMICNAME = 5;
	public final int SEARCH_BY_LASTNAME_AND_PATRONYMICNAME = 6;
	public final int SEARCH_BY_ALL = 7;
	
	Waiter getByID(long id) throws EntityNotFoundException, SQLException;
	
	List<Waiter> getAllWaiters() throws  SQLException, EntityNotFoundException;
	
	List<Waiter> getAllWaitersByName(int searchType, String... params) throws EntityNotFoundException, SQLException;
	
	void addWaiter(Waiter waiter) throws SQLException;
	
	void removeByID(long ID) throws EntityNotFoundException, SQLException; 
	
	Set<Order> getWaitersOrders(long waiterId) throws EntityNotFoundException,  SQLException, NoLinksException;
	
	void updateWaiter(long id, int field, Object value)  throws EntityNotFoundException, SQLException;	
}
